﻿@using OA.Model.View;
@using OA.Model;
@using X.PagedList;
@using OA.Core.Helper;

@model PageList<Mailbox>
@{
    CustomForm infoCustomForm = ViewBag.CustomForm;
    string title = "我的发件箱";
    ViewBag.Title = title;
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";

}
<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm">
        <form action="" class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: auto; padding-right: 5px;">主题：</label>
                <div class="layui-input-inline">
                    <input type="text" name="keyWord" class="layui-input" value="" />
                </div>
                <button type="button" class="layui-btn searchButton">搜索</button>
            </div>
        </form>
    </div>
    <table class="layui-table" lay-data="{url:'GetOutBoxData', cellMinWidth: 80, page: true,limit:15}" id="resultList" lay-filter="resultList">
        <thead>
            <tr>
                <th lay-data="{field:'No', width:120}">单据号</th>
                <th lay-data="{field:'Title', width:400}">标题</th>
                <th lay-data="{field:'ToDepartmentName', width:120}">发送人部门</th>
                <th lay-data="{field:'ToPositionName', width:120}">发送人岗位</th>
                <th lay-data="{field:'ToEmpName', width:120}">发送人</th>
                <th lay-data="{field:'CreateDateTime', width:160}">发送时间</th>
                <th lay-data="{field:'StatusName', width:80}">状态</th>
                <th lay-data="{width:120, align:'center', toolbar: '#barDemo'}">操作</th>
            </tr>
        </thead>
    </table>
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-xs" href="javascript:ShowPage('/Member/Mailbox/Index/{{d.ID}}?type=inbox','邮件：{{d.Title}}')">查看</a>
        {{# if(d.Status==0){ }}
        <span onclick="Delete('{{d.ID}}','{{d.ToEmpName}}','{{d.Title}}')" class="layui-btn layui-btn-xs delete">删除</span>
        {{# } }}
    </script>
</div>

<script type="text/javascript">
    function Delete(currentID, empName, title) {
        layer.confirm('您真的要删除此抄送？<p style="color:red;">收件人：' + empName + '</p><p style="color:red;">主题：' + title + '</p>', {
            btn: ['是的', '不小心点错了'], area: ['600px', '225px'], title: "删除抄送确认"
        }, function () {
            layer.msg("正在删除，请稍后...");
            var url = "/Member/Mailbox/Delete/" + currentID;
            $.getJSON(url, function (result) {
                if (result.State == 200) {
                    window.location.href = window.location.href;
                    return;
                }
                else {
                    layer.msg(result.Msg);
                }
            });

        }, function () {

        });
    }     
</script>
